#define _CRT_SECURE_NO_WARNINGS 1

#include<stdio.h>

int removeDuplicates(int* nums, int numsSize) {
    int src = 1, dst = 0;
    while (src < numsSize) {
        if (nums[src] == nums[dst]) {
            src++;
        }
        else {
            nums[++dst] = nums[src++];
        }
    }
    return dst + 1;
}

int main()
{
    int nums[3] = { 1,1,2 };
    int numsSize = sizeof(nums) / sizeof(nums[0]);
    int k = removeDuplicates(nums, numsSize);
    printf("%d\n", k);
    int begin = 0;
    for (begin = 0; begin < k; begin++)
    {
        printf("%d ", nums[begin]);
    }
	return 0;
}